class Student {
    constructor({
      id,
      name,
      major,
      year,
      score,
      gpa,
      skill,
      direction,
      introduction,
      resume,
      Sex,
      created_date: createdDate,
      updated_date: updatedDate,
    }) {
      this.student = {
        id: String,
        name: String,
        major: String,
        year: String,
        score: String,
        gpa:String,
        skill:String,
        direction:String,
        introduction:String,
        resume:String,
        Sex:Number,
        created_date: Number,
        updated_date: Number,
      }
      this.student.id = id
      this.student.name = name
      this.student.major = major
      this.student.year = year
      this.student.score = score
      this.student.gpa = gpa
      this.student.skill = skill
      this.student.direction = direction
      this.student.introduction = introduction
      this.student.resume = resume
      this.student.Sex = Sex
      this.student.created_date = createdDate
      this.student.updated_date = updatedDate
    }
  
    getData() {
      const { student } = this
      const studentWithNoNull = { ...this.student }
  
      const properties = Object.getOwnPropertyNames(this.student)
  
      properties.forEach((property) => {
        if (Reflect.get(this.student, property) == null) {
          Reflect.deleteProperty(studentWithNoNull, property)
        }
      })
  
      return { student, studentWithNoNull }
    }
  
    get id() {
      return this.student.id === undefined ? null : this.student.id
    }
  
    set id(value) {
      this.student.id = value
    }

    get name() {
        return this.student.name === undefined ? null : this.student.name
      }
    
    set name(value) {
        this.student.name = value
    }

    get major() {
        return this.student.major === undefined ? null : this.student.major
      }
    
    set major(value) {
        this.student.major = value
    }

    get year() {
        return this.student.year === undefined ? null : this.student.year
      }
    
    set year(value) {
        this.student.year = value
    }

    get score() {
        return this.student.score === undefined ? null : this.student.score
      }
    
    set score(value) {
        this.student.score = value
    }

    get gpa() {
        return this.student.gpa === undefined ? null : this.student.gpa
      }
    
    set gpa(value) {
        this.student.gpa = value
    }

    get skill() {
        return this.student.skill === undefined ? null : this.student.skill
      }
    
    set skill(value) {
        this.student.skill = value
    }

    get direction() {
        return this.student.direction === undefined ? null : this.student.direction
      }
    
    set direction(value) {
        this.student.direction = value
    }

    get introduction() {
        return this.student.introduction === undefined ? null : this.student.introduction
      }
    
    set introduction(value) {
        this.student.introduction = value
    }

    get resume() {
        return this.student.resume === undefined ? null : this.student.resume
      }
    
    set resume(value) {
        this.student.resume = value
    }

    get Sex() {
        return this.student.Sex === undefined ? null : this.student.Sex
    }

    set Sex(value) {
        this.student.Sex = value
    }


    get createdDate() {
      return this.student.created_date === undefined
        ? null
        : this.student.created_date
    }
  
    set createdDate(value) {
      this.student.created_date = value
    }
  
    get updatedDate() {
      return this.student.updated_date === undefined
        ? null
        : this.student.updated_date
    }
  
    set updatedDate(value) {
      this.student.updated_date = value
    }
  }
  
  module.exports = Student
  